package com.runshu.exception;

import lombok.Data;

/**
 * Created by DON on 2015/7/13.
 */
@Data
public class RestException extends Exception {
    private int code;
    private String reason;

    public static RestException Error(int code, String reason) {
        RestException ex = new RestException();
        ex.setCode(code);
        ex.setReason(reason);
        return ex;
    }

    public static RestException Error(ErrorEnum errorEnum) {
        return RestException.Error(errorEnum.Code(), errorEnum.Msg());
    }

}
